aggregation should group the elements by a field of their root record